class Solution {
    public int minSubArrayLen(int target, int[] nums) {
        int left=0;
        int right=0;
        int sum=0;
        int min=nums.length;
        while(left<= nums.length-1&&right <=nums.length-1){
            sum+=nums[right];
            if(sum<target){
               right++;
            }else{
                sum=sum-nums[left];
                if((right-left+1)<min){
                  min=right-left+1;
                }
               
                left++;
            }

        }
        return min;

    }
}